#include<iostream>
#include <vector>
using namespace std;

const int N = 100005;
int n;
int ret = N;
bool vis[N];
vector<vector<int>> ed;


int dfs(int u)
{
    vis[u] = true;
    int sum = 1, res = 0;
    for (auto& e : ed[u])
    {
        if (!vis[e])
        {
            int s = dfs(e);
            sum += s;
            res = max(res, s);
        }
    }
    res = max(n - sum, res);

    ret = min(res, ret);

    return sum;
}

int main()
{
    cin >> n;
    ed.resize(n + 1);

    for (int i = 0; i < n - 1; ++i)
    {
        int a, b; cin >> a >> b;
        ed[a].push_back(b);
        ed[b].push_back(a);
    }

    dfs(1);

    cout << ret << endl;
    return 0;
}